home *** CD-ROM | disk | FTP | other *** search
/ Supercompiler 1997 / SUPERCOMPILER97.iso / Delphi 3.0 / DATA.Z / HOTKIMPL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-01-30  |  2.8 KB  |  118 lines

  1. unit HotKImpl;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
  7.   ComServ, StdVCL, AXCtrls, DelLib, ComCtrls;
  8.  
  9. type
  10.   THotKeyX = class(TActiveXControl, IHotKeyX)
  11.   private
  12.     { Private declarations }
  13.     FDelphiControl: THotKey;
  14.     FEvents: IHotKeyXEvents;
  15.   protected
  16.     { Protected declarations }
  17.     procedure InitializeControl; override;
  18.     procedure EventSinkChanged(const EventSink: IUnknown); override;
  19.     procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
  20.     function Get_AutoSize: WordBool; safecall;
  21.     function Get_Cursor: Smallint; safecall;
  22.     function Get_Enabled: WordBool; safecall;
  23.     function Get_HotKey: Smallint; safecall;
  24.     function Get_Visible: WordBool; safecall;
  25.     procedure AboutBox; safecall;
  26.     procedure Set_AutoSize(Value: WordBool); safecall;
  27.     procedure Set_Cursor(Value: Smallint); safecall;
  28.     procedure Set_Enabled(Value: WordBool); safecall;
  29.     procedure Set_HotKey(Value: Smallint); safecall;
  30.     procedure Set_Visible(Value: WordBool); safecall;
  31.   end;
  32.  
  33. implementation
  34. uses HotKPg;
  35. { THotKeyX }
  36.  
  37. procedure THotKeyX.InitializeControl;
  38. begin
  39.   FDelphiControl := Control as THotKey;
  40. end;
  41.  
  42. procedure THotKeyX.EventSinkChanged(const EventSink: IUnknown);
  43. begin
  44.   FEvents := EventSink as IHotKeyXEvents;
  45. end;
  46.  
  47. procedure THotKeyX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
  48. begin
  49.   { Define property pages here.  Property pages are defined by calling
  50.     DefinePropertyPage with the class id of the page.  For example,
  51.       DefinePropertyPage(Class_HotKeyXPage); }
  52. end;
  53.  
  54. function THotKeyX.Get_AutoSize: WordBool;
  55. begin
  56.   Result := FDelphiControl.AutoSize;
  57. end;
  58.  
  59. function THotKeyX.Get_Cursor: Smallint;
  60. begin
  61.   Result := Smallint(FDelphiControl.Cursor);
  62. end;
  63.  
  64. function THotKeyX.Get_Enabled: WordBool;
  65. begin
  66.   Result := FDelphiControl.Enabled;
  67. end;
  68.  
  69. function THotKeyX.Get_HotKey: Smallint;
  70. begin
  71.   Result := Smallint(FDelphiControl.HotKey);
  72. end;
  73.  
  74. function THotKeyX.Get_Visible: WordBool;
  75. begin
  76.   Result := FDelphiControl.Visible;
  77. end;
  78.  
  79. procedure THotKeyX.AboutBox;
  80. begin
  81.   ShowHotKeyXAbout;
  82. end;
  83.  
  84. procedure THotKeyX.Set_AutoSize(Value: WordBool);
  85. begin
  86.   FDelphiControl.AutoSize := Value;
  87. end;
  88.  
  89. procedure THotKeyX.Set_Cursor(Value: Smallint);
  90. begin
  91.   FDelphiControl.Cursor := TCursor(Value);
  92. end;
  93.  
  94. procedure THotKeyX.Set_Enabled(Value: WordBool);
  95. begin
  96.   FDelphiControl.Enabled := Value;
  97. end;
  98.  
  99. procedure THotKeyX.Set_HotKey(Value: Smallint);
  100. begin
  101.   FDelphiControl.HotKey := TShortCut(Value);
  102. end;
  103.  
  104. procedure THotKeyX.Set_Visible(Value: WordBool);
  105. begin
  106.   FDelphiControl.Visible := Value;
  107. end;
  108.  
  109. initialization
  110.   TActiveXControlFactory.Create(
  111.     ComServer,
  112.     THotKeyX,
  113.     THotKey,
  114.     Class_HotKeyX,
  115.     9,
  116.     '{5A565985-7975-11D0-BE02-00A024D1875C}');
  117. end.
  118.